<?php
namespace app\admin\model;

use think\Model;
use think\facade\Db;
class AdminUser extends Model{
/**
 * 根据用户名获取后端数据
 * Undocumented function
 * @param [type] $username
 * @return void
 */

    protected $table = 'mall_admin_user';
    public function getAdminUserByUsername($data){
        if (empty($data)) {
            return false;
        }

        $username = $data['username'];

        $table = $this->where('username',$username)->find();
        return $table;
    }

    /**
     * Undocumented function
     *根据主键ID
     * @param [type] $id
     * @param [type] $data
     * @return void
     */

    public function updataById($id,$data){
        $id = intval($id);
        if (empty($id) || empty($data) || !is_array($data) ) {
            return false;
        }

        $where = [
            "id" => $id,
        ];

        return $this->where($where)->save($data);
    }

}



